import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import utils.CalculatorUtil;
import utils.ParseUtil;

/**
 *Description:
 *Version:1.0.0
 *@author shihb
 *@date 2020/11/11 22:05
 */
public class ColumnCalculation {

  public static void main(String[] args) {
    Map<String, Object> map = new HashMap<>();
    map.put("a", 2);
    map.put("b", 2);
    map.put("c",3);
    String  sourceStr= "{2}-{0}";
    Object[] object = new Object[]{"a","b","c"};

    // 替换占位符
    String exprStr = ParseUtil.parsePlaceholder(sourceStr, object,"${","}");
    // 替换变量
    String  expression= ParseUtil.parseExprStr(exprStr, map);

    System.out.println(expression);
    System.out.println(CalculatorUtil.conversion(expression));
  }

}

